package com.example.iotlink.service.impl;

import com.example.iotlink.bean.Receipt;
import com.example.iotlink.service.ITopicHandleStrategy;
import lombok.extern.slf4j.Slf4j;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class AlarmLowerReceiptHandleStrategy implements ITopicHandleStrategy {
    @Override
    public void handelReceiveTopic(Receipt receipt) {
//        System.err.println("解析 低于下限告警");
        log.info("低于下限告警:{}",receipt);

//        Message<?> message = receipt.getMessage();
//        log.info("mqtt_receivedRetained: {}", message.getHeaders().get("mqtt_receivedRetained"));
//        log.info("mqtt_id: {}", message.getHeaders().get("mqtt_id"));
//        log.info("mqtt_duplicate: {}", message.getHeaders().get("mqtt_duplicate"));
//        log.info("id: {}", message.getHeaders().get("id"));
//        log.info("mqtt_receivedTopic: {}", message.getHeaders().get("mqtt_receivedTopic"));
//        log.info("mqtt_receivedQos: {}", message.getHeaders().get("mqtt_receivedQos"));
//        log.info("timestamp: {}", message.getHeaders().get("timestamp"));
//        log.info("收到消息：" + (String) message.getPayload());
    }
}
